<form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">

    <div class="modal-header">
        <h4 class="modal-title" id="myCatalogLabel" jhiTranslate="bookstoreApp.catalog.home.createOrEditLabel">Create or edit a Catalog</h4>
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"
                (click)="clear()">&times;</button>
    </div>
    <div class="modal-body">
        <jhi-alert-error></jhi-alert-error>
        <div class="form-group" [hidden]="!catalog.id">
            <label for="id" jhiTranslate="global.field.id">ID</label>
            <input type="text" class="form-control" id="id" name="id"
                   [(ngModel)]="catalog.id" readonly />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.catalog.catalog" for="field_catalog">Catalog</label>
            <input type="text" class="form-control" name="catalog" id="field_catalog"
                [(ngModel)]="catalog.catalog" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.catalog.content" for="field_content">Content</label>
            <input type="text" class="form-control" name="content" id="field_content"
                [(ngModel)]="catalog.content" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.catalog.pCatalog" for="field_pCatalog">P Catalog</label>
            <input type="text" class="form-control" name="pCatalog" id="field_pCatalog"
                [(ngModel)]="catalog.pCatalog" />
        </div>

        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.catalog.bookId" for="field_bookId">Book Id</label>
            <select class="form-control" id="field_bookId" name="bookId" [(ngModel)]="catalog.bookId" >
                <option [ngValue]="null"></option>
                <option [ngValue]="bookBasicOption.id === catalog.bookId?.id ? catalog.bookId : bookBasicOption" *ngFor="let bookBasicOption of bookbasics; trackBy: trackBookBasicById">{{bookBasicOption.id}}</option>
            </select>
        </div>
    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="clear()">
            <span class="fa fa-ban"></span>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
        </button>
        <button type="submit" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary">
            <span class="fa fa-save"></span>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
        </button>
    </div>
</form>
